using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;
namespace DAO
{
    public class BaoCaoDoanhThuDAO
    {
        DataProvider Provider;
        public BaoCaoDoanhThuDAO()
        {
            Provider = new DataProvider();
        }

        public DataTable LayThongTinBaoCaoDoanhThu(int thangBaoCao)
        {
            Provider.Connect();
            string str = "select pk.NgayKham, count(pk.MaPhieuKham) as SoBenhNhan, sum(pk.TienThuoc + pk.TienKhamHienTai) as DoanhThu, avg(pk.TienThuoc) as TyLe From PhieuKham pk Group by pk.NgayKham Having Month(pk.NgayKham) = " + thangBaoCao;
            DataTable dt = new DataTable();
            OleDbDataAdapter da;
            da = new OleDbDataAdapter(str, Provider.cn);
            da.Fill(dt);
            Provider.Disconnect();
            return dt;
        }
    }
}
